import createAxios from '/@/utils/axios'
import { useAdminInfo } from '/@/stores/adminInfo'

export const url = '/admin/Index/'

export function index() {
    return createAxios({
        url: url + 'index',
        method: 'get',
    })
}

export function login(method: 'get' | 'post', params: object = {}) {
    return createAxios({
        url: url + 'login',
        data: params,
        method: method,
    })
}

export function logout() {
    const adminInfo = useAdminInfo()
    return createAxios({
        url: url + 'logout',
        method: 'POST',
        data: {
            refreshToken: adminInfo.getToken('refresh'),
        },
    })
}

export function getFeeitemList(){
    return createAxios({
        url: '/admin/routine.Feeitem/index',
        method: 'get',
        params: {
            limit: 10000
        }
    })
}

export function getProjectFeeitem(data: any){
    return createAxios({
        url: '/admin/ProjectFeeitem/index',
        method: 'post',
        data: data
    })
}

export function updateProjectFeeitem(data: any){
    return createAxios({
        url: '/admin/ProjectFeeitem/update',
        method: 'post',
        data: data
    })
}

export function updateProjectFeeitemRemark(data: any){
    return createAxios({
        url: '/admin/ProjectFeeitem/updateRemark',
        method: 'post',
        data: data
    })
}

export function getProjectFeeitemStatics(data: any){
    return createAxios({
        url: '/admin/Project/Statics',
        method: 'post',
        data: data
    })
}

export function getProjectWfRecord(data: any){
    return createAxios({
        url: '/admin/Project/wfrecord',
        method: 'post',
        data: data
    })
}

export function exportProject(data: any){
    return createAxios({
        url: '/admin/Project/export',
        method: 'post',
        data: data
    })
}

export function getWorkerFlowDetail(data: any){
    return createAxios({
        url: '/admin/workflow.Workflow/detail',
        method: 'post',
        data: data
    })
}


export function wfAudit(data: any){
    return createAxios({
        url: '/admin/workflow.Workflow/audit',
        method: 'post',
        data: data
    })
}

export function getSupplier(data: any){
    return createAxios({
        url: '/admin/Supplier/index',
        method: 'get',
        params: data
    })
}

export function reimbursementPaid(data: any){
    return createAxios({
        url: '/admin/apply.Reimbursement/paid',
        method: 'post',
        data: data
    })
}

export function advancePaid(data: any){
    return createAxios({
        url: '/admin/apply.Advance/paid',
        method: 'post',
        data: data
    })
}

export function paymentPaid(data: any){
    return createAxios({
        url: '/admin/apply.Payment/paid',
        method: 'post',
        data: data
    })
}

export function feeitemDetail(data: any){
    return createAxios({
        url: '/admin/ProjectFeeitem/feeitemDetail',
        method: 'post',
        data: data
    })
}

export function feeitemsDetail(data: any){
    return createAxios({
        url: '/admin/ProjectFeeitem/feeitemsDetail',
        method: 'post',
        data: data
    })
}

export function projectToAudit(data: any){
    return createAxios({
        url: '/admin/Project/toAudit',
        method: 'post',
        data: data
    })
}

export function projectDetail(data: any){
    return createAxios({
        url: '/admin/Project/index',
        method: 'post',
        data: data
    })
}

export function companyLists(){
    return createAxios({
        url: '/admin/cashflow.Company/index',
        method: 'get',
        params: {
            limit: 1000,
        }
    })
}

export function getProjects(){
    return createAxios({
        url: '/admin/Project/index',
        method: 'get',
        params: {
            limit: 1000,
        }
    })
}